package com.enzo.pcms.base.controller;
import com.itool.util.StringUtil;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;


public class BaseController {
	protected String viewName;
	protected String modelName;
	protected Map<String,Object> model;
	
	public BaseController(){
		model=new HashMap<String,Object>();
		modelName="model";
	}
	
	protected ModelAndView getModelAndView(){
		if(StringUtil.isNotEmpty(modelName)&&model!=null){
			return new ModelAndView(viewName, modelName, model);
		}else{
			return new ModelAndView(viewName);
		}
	}
	
	protected ModelAndView getModelAndView(String viewName,String modelName,Map<String,Object> model) {
		return new ModelAndView(viewName, modelName, model);
	}
}
